#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <limits>
#include <vector>

#include <boost\numeric\interval.hpp>

#include <gmpxx.h>

#include "../convex_hull.h"
#include "convex_hull_iterator.h"

int main()
{
    size_t n;
    std::cin >> n;

    std::vector<point> vertices;
    vertices.resize(n);

    for (size_t i = 0; i < n; i++) {
        std::cin >> vertices[i];
    }

    //Finding convex hull
 
    auto convex_hull = quick_hull_wrapper(vertices);

    //Convex hull has been founded. Making a minimum containing rectangle...
    std::reverse_iterator<std::vector<point>::iterator> it (convex_hull);

    std::cout << std::min_element(convex_hull_iterator(it, convex_hull, vertices.begin(), vertices.rend()), convex_hull_iterator(vertices.rend()));
}